<?php
	include "common.php";
	error_reporting(0);
	session_start();	
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$systemDate=date('y-m-d');
	
	$message = $_POST['message'];
	$id = $_POST['whom'];
	$empId = $_SESSION['id'];
	
	//$employeeId = $e_id;	
	$resultsql = "select * from user where e_id= '$empId'";
	$result = mysql_query($resultsql);
	$resultsqltable = mysql_fetch_array($result);
	
	$employeeId = $resultsqltable['e_id'];
	$sender = $resultsqltable['f_name']." ".$resultsqltable['l_name'];
	
	$recipientSql  = "SELECT * FROM user WHERE e_id = '$id'";
	$recipientSqlQuery = mysql_query($recipientSql);
	$recipientSqlResult = mysql_fetch_assoc($recipientSqlQuery);
	
	$recipient = $recipientSqlResult['f_name']." ".$recipientSqlResult['l_name'];

	echo $sql="INSERT INTO black_box_message(date,sender, to_whom, message, to_whom_id, status)
			   VALUES ('$systemDate','$sender','$recipient','$message','$id',1)";
	mysql_query($sql);
	
	$notificationSelectSql = "SELECT * FROM user WHERE e_id = '$id'";
	$notificationSelectSqlQuery = mysql_query($notificationSelectSql);
	$notificationSelectSqlQueryResult = mysql_fetch_assoc($notificationSelectSqlQuery);
		
	$notification = $notificationSelectSqlQueryResult['notification'];
	$notification++;
		
	$updateNotificationSql = "UPDATE user SET notification = '$notification' WHERE e_id = '$id'";
	$updateNotificationSqlQuery = mysql_query($updateNotificationSql);
	
	mysql_close($con);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="blackbox.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<div class="new_notification">
        	<img src="images/arrow_up.JPG" /><p>You have a new notification</p>
        </div><!--end of new_notification-->
		
    	<ul>
        	<a href="ceo.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="ceo_employee.php"><li><div id="employee"></div><p>employee</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="on_duty.php"><li><div id="onduty"></div><p>on duty</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="ceo_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="ceo_notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="ceo_blackbox.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="#"><li><div id="hrpolicy"></div><p>hr policy</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
        </ul>
    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>view as: <a href="ceo_blackbox.php?check=1">send</a> | <a href="ceo_blackbox.php?check=2">check</a></p>
</div><!-- end of othrpage_1-->
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->
<div class="page_content">	
	<p>Thank You Very Much...</p>
</div>
</body>
</html>
